    $(function() {

        $("#checkAll").click(function(){
            $('input:checkbox').not(this).prop('checked', this.checked);
        });

        $('#startDate1').datepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd'
        });

        $('#endDate1').datepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd'
        });
        $('#startDate2').datepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd'
        });

        $('#endDate2').datepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd'
        });

        $("#project_data").bsSuggest({
            idField: 'projectId',                    //每组数据的哪个字段作为 data-id，优先级高于 indexId 设置（推荐）
            keyField: 'projectName',                   //每组数据的哪个字段作为输入框内容，优先级高于 indexKey 设置（推荐）
            effectiveFields: ["projectId","projectCode","projectName"],
            effectiveFieldsAlias: {"projectId":"ID","projectCode":"编号","projectName":"名称"},
            searchFields: ["projectId","projectCode","projectName"],
            showBtn: true,
            data: {
                'value':projectList
            }
        }).on('onSetSelectValue', function (e, keyword) {
            $("#proId").val(keyword.id);
        }).on('onUnsetSelectValue', function (e) {
            $("#proId").val("");
        });
        $("#supplier_data").bsSuggest({
            idField: 'suppId',                    //每组数据的哪个字段作为 data-id，优先级高于 indexId 设置（推荐）
            keyField: 'suppName',                   //每组数据的哪个字段作为输入框内容，优先级高于 indexKey 设置（推荐）
            effectiveFields: ["suppId","suppCode","suppName"],
            effectiveFieldsAlias: {"suppId":"ID","suppCode":"编号","suppName":"名称"},
            searchFields: ["suppId","suppCode","suppName"],
            showBtn: true,
            data: {
                'value':supplierList
            }
        }).on('onSetSelectValue', function (e, keyword) {
            $("#suppId").val(keyword.id);
        }).on('onUnsetSelectValue', function (e) {
            $("#suppId").val("");
        });

    });


var data = function(d){
    d.orderId=$("#orderquery").find("input[name='orderId']").val();
    d.proId=$("#proId").val();
    d.empName=$("#orderquery").find("input[name='empName']").val();
    d.idenCardNum=$("#orderquery").find("input[name='idenCardNum']").val();
    d.cardNum=$("#orderquery").find("input[name='cardNum']").val();
    d.qCardNumGt=$("#orderquery").find("input[name='qCardNumGt']").val();
    d.qCardNumLt=$("#orderquery").find("input[name='qCardNumLt']").val();
    d.suppId=$("#suppId").val();
    d.state=$("#orderquery").find("select[name='state']").val();
    d.platId=$("#orderquery").find("select[name='platId']").val();
    d.startDate1=$("#orderquery").find("input[name='startDate1']").val();
    d.endDate1=$("#orderquery").find("input[name='endDate1']").val();
    d.startDate2=$("#orderquery").find("input[name='startDate2']").val();
    d.endDate2=$("#orderquery").find("input[name='endDate2']").val();
    if($("#create_type").val()=="admin"){
        d.dataSource=2;
    }
};
function getPath() {
        var pathName = window.document.location.pathname;
        var projectName = pathName
            .substring(0, pathName.substr(1).indexOf('/') + 1);
        return projectName;
}
function columns()
{
    return [
        {
            "data": "orderId",
            "createdCell": function (td, cellData, rowData, row, col) {
                $(td).html("<input type='checkbox' name='checkList' value='" + cellData + "'>");
            }
            ,"defaultContent" : ""
        },
        {"data":"cardNum"
            ,"defaultContent" : ""},
        {"data":"orderId"
            ,"defaultContent" : ""},
        {"data":"proId"
            ,"defaultContent" : ""},
        {"data":"projectName"
            ,"defaultContent" : ""},
        {"data":"empId"
            ,"defaultContent" : ""},
        {"data":"empName"
            ,"defaultContent" : ""},
        {
            "data":"sex",
            "createdCell": function (td, cellData, rowData, row, col) {
                var htmltype="";
                if(cellData==1){
                    htmltype="男";
                }else{
                    htmltype="女";
                }
                $(td).html(htmltype);
            }
            ,"defaultContent" : ""
        },
        {"data":"idenCardNum"
            ,"defaultContent" : ""},
        {"data":"suppName"
            ,"defaultContent" : ""},

        {"data":"reservString"
            ,"defaultContent" : ""},
        {"data":"commitString"
            ,"defaultContent" : ""},
        {
            "data":"state",
            "createdCell": function (td, cellData, rowData, row, col) {
                var htmlsta="";
                if(cellData==2){
                    htmlsta="已提交";
                }else if(cellData==3){
                    htmlsta="已确认";
                }else if(cellData==4){
                    htmlsta="客户取消";
                }else if(cellData==5){
                    htmlsta="易才取消";
                }else if(cellData==6){
                    htmlsta="已到检";
                }else if(cellData==7){
                    htmlsta="体检报告已生成";
                }
                $(td).html(htmlsta);
            }
            ,"defaultContent" : ""
        },
        {
            "data": "orderId",
            "createdCell": function (td, cellData, rowData, row, col) {
                var basePath=getPath();
                var typeStr="&type=";
                if($("#create_type").val()=="admin"){
                    typeStr+="2";
                }else{
                    typeStr+="1";
                }
                $(td).html("<a  value='"
                    + cellData +
                    "'  href='"
                    +detailUrl+
                    +cellData+typeStr+
                    "'   >查看</a>");

            }
            ,"defaultContent" : ""
        }
    ];
}
$('#search').click(function()
{
    table.draw();
});
